/**
 * 
 */
package com.sci.web.action.eninfomanager;

import java.util.List;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.bean.Enterprise_Base;
import com.sci.web.dao.EnterpriseInfoManageDao;
import com.sci.web.dao.RegisterInfoCheckDao;

/**
 * @author  BaiFuyou
 * @date: Oct 15, 2011 9:22:43 AM
 * 
 * 根据用户角色返回不同的列表信息
 * 用户用户信息审核
 */
public class GetEnterpriseInfoByUserRoleAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6845599782760923132L;
	@Resource
	private RegisterInfoCheckDao registerInfoCheckDao;
	@Resource
	private EnterpriseInfoManageDao enterpriseInfoManageDao;
	/**
	 * 对应的城市ID
	 */
	private int city_id;
	/**
	 * 1未审核；2未通过；3审核通过
	 */
	private int flag;
	/**
	 * @return the city_id
	 */
	public int getCity_id() {
		return city_id;
	}
	/**
	 * @param city_id the city_id to set
	 */
	public void setCity_id(int city_id) {
		this.city_id = city_id;
	}
	/**
	 * @return the flag
	 */
	public int getFlag() {
		return flag;
	}
	/**
	 * @param flag the flag to set
	 */
	public void setFlag(int flag) {
		this.flag = flag;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stubregisterInfoCheckDao
		List<Enterprise_Base> list = null;
		System.out.println(city_id+" 白福友  "+flag);
		/**
		 * 最高用户的权限是的城市id为-1
		 */
		//普通市级用户进行处理
		if(city_id != -1 ){
			list = enterpriseInfoManageDao.getAllEnterprise_BaseByCityidAndUserId(city_id, flag);
		}
		//最高权限用户
		if(city_id == -1){
			list = enterpriseInfoManageDao.getAllEnterprise_BaseByCityidAndUserId(flag);
		}
		super.setContentType(super.JSON);
		outPrint(super.getJSONArrayString(list));
		return "json";
	}
}
